"""
Author: Morphlng
Date: 2024-12-14 20:49:01
LastEditTime: 2024-12-18 16:06:40
LastEditors: Morphlng
Description: Done interface.
FilePath: /DrivingGym/src/driving_gym/environment/agent/done/base_done.py
"""

from __future__ import annotations

from driving_gym.data.data_provider import Snapshot
from driving_gym.environment.scenario.base_scenario import BaseScenario
from driving_gym.simulation.adapter_interface import AdapterInterface


class BaseDone:
    def __init__(self, config: dict, adapter: AdapterInterface = None):
        self.config = config.copy()
        self.adapter = adapter
        self.type: str = config.get("type", "default")
        self.params: dict = config.get("params", {})

        # This is automatically set by the environment
        self.actor_id: str = self.config["actor_id"]

    def reset(self):
        """Reset the done handler."""
        pass

    def get_done(self, snapshot: Snapshot, scenario: BaseScenario) -> tuple[bool, str]:
        """Check if any done condition is met."""
        return False, "NOT_DONE"
